<template>
  <div class="shopping-footer container">
      <div class="shopping-cart">
          <p class="cart-info">商品合计：<span class="cart-price">￥<span>{{ allPrice }}</span></span></p>
          <p class="cart-fare">免运费</p>
      </div>
      <div class="shopping-btn" @click="handleJump">去结算</div>
  </div>
</template>

<script>
// import junpPage from '@/mixin/common'
import junpPage from '../mixin/common'
import {mapState} from 'vuex'
export default {
    name: 'ShoppingFooterBanner',
    mixins: [junpPage],
    methods: {
        handleJump() {
            this.$router.push('/order')
        }
    },
    computed: {
        ...mapState(['detailList']),
        allPrice() {
            return this.detailList.reduce((prev, current) => {
                if(current.done) {
                    return prev + (current.price * current.count)
                }
                return prev;
            }, 0);
        }
    }
}
</script>

<style scoped>
.shopping-footer {
    display: flex;
    height: 50px;
    color: #fff;
    font-size: 15px;
    align-items: center;
}
.shopping-cart {
    width: 80%;
    height: 100%;
    line-height: 100%;
    padding-left: 20px;
    background-color: #FEC76C;
    align-items: center;
    color: #000;
    font-weight: bold;
    padding: 5px 0 5px 20px;
    box-sizing: border-box;
}
.cart-price {
    color: #ED7B51;
    font-size: 12px;
}
.cart-price span {
    font-size: 15px;
}
.cart-fare {
    color: #444;
    font-size: 12px;
    margin-top: 5px;
}
.shopping-btn {
    width: 20%;
    line-height: 50px;
    background-color: #FD7722;
    text-align: center;
}
</style>